package com.roy.HadoopRPCDemo.executor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.roy.HadoopRPCDemo.anno.ServiceExe;
import com.roy.HadoopRPCDemo.bean.RPCResBean;
import com.roy.HadoopRPCDemo.bean.UserBean;

/**
 * 暂定所有方法的参数都为String,返回类型都为RPCResBean
 * @author Administrator
 *
 */
public class UserExecutor {

	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@ServiceExe(exeId = "initUser")
	public RPCResBean initUserInfo(String userId,String userName) {
		logger.info("initUser");
		UserBean user = new UserBean();
		user.setUserId(Integer.parseInt(userId));
		user.setUserName(userName);
		user.setUserPassword("init password");
		user.setUserInfo("init from server");
		
		RPCResBean res = new RPCResBean();
		res.setOpCode(0);
		res.setInfo("init user Successed");
		return res;
	}
	
	@ServiceExe(exeId = "destroyUser")
	public RPCResBean destroyUser(String userId) {
		logger.info("destroyUser");
		UserBean user = new UserBean();
		user.setUserId(Integer.parseInt(userId));
		
		RPCResBean res = new RPCResBean();
		res.setOpCode(0);
		res.setInfo("destroy user Successed");
		return res;
	}
	
	
}
